From: Keir Fraser Date: Thu, 6 May 2010 10:13:22 +0000 (+0100) Subject: xm: Add exception handling when launching vncviewer X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12246 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=c177a9f12257b753181974fca1da88f9bbc28e80;p=xen.git xm: Add exception handling when launching vncviewer Also replaces the call to 'puts' with 'print' as the former is undefined in python Signed-off-by: Goncalo Gomes --- diff --git a/tools/python/xen/xm/console.py b/tools/python/xen/xm/console.py index f31d561836..ce86369c63 100644 --- a/tools/python/xen/xm/console.py +++ b/tools/python/xen/xm/console.py @@ -74,10 +74,15 @@ def runVncViewer(domid, do_autopass, do_daemonize=False): if do_daemonize: pid = utils.daemonize('vncviewer', cmdl, vnc_password_tmpfile) if pid == 0: - puts >>sys.stderr, 'failed to invoke vncviewer' + print >>sys.stderr, 'failed to invoke vncviewer' os._exit(-1) else: print 'invoking ', ' '.join(cmdl) if vnc_password_tmpfile is not None: os.dup2(vnc_password_tmpfile.fileno(), 0) - os.execvp('vncviewer', cmdl) + try: + os.execvp('vncviewer', cmdl) + except OSError: + print >>sys.stderr, 'Error: external vncviewer missing or not \ +in the path\nExiting' + os._exit(-1)